#! /usr/bin/env bash
#
# template.diags_generate used to create the $CASEROOT/$CASE.ocn_diagnostics
#
# TODO - need to get the PE count from the config_pes.xml tag
# for the specified machine
# <ocn_diags_pes>##</ocn_diags_pes>
#

{{ batchdirectives }}

mpirun={{ mpirun }}

# xmlquery to get POSTPROCESS_VIRTUALENV, BATCHSUBMIT variable settings
virtualEnvDir=`./xmlquery POSTPROCESS_VIRTUALENV -value`
caseRoot=`./xmlquery CASEROOT -value`

cd $virtualEnvDir/bin
activate virtualenv

$mpirun ./ocn_diags_generator.py --caseroot $caseRoot >> $caseRoot/tSeriesStatus 2>&1

deactivate
